Ext.define('AmpleHarvest.views.application.appsToFile',
{
	extend			: 'Ext.window.Window',
	alias			: 'widget.ampleharvest-views-application-appstofile',
	title			: 'Apps that use this file',
	minimizable		: false,
	maximizable		: true,
	width			: '90%',
	requires		: [
	        		   'AmpleHarvest.DATA.Model.gsSolr'
	        		   ],
	shim			: false,
	animCollapse	: false,
	constrainHeader	: true,
	modal			: true,
	buttons		:
		[
				{
					text		: 'Cancel',
					disabled	: false,
					scope		: this,
					handler		: function()
					{
						this.close();
					}
				}
		],
		
	initComponent	: function()
	{
		var obj_data = {
				data : this.m_arr_appdata
		}
		
		var obj_applist = Ext.create('Ext.grid.Panel',
				{
					alias			: 'widget.ampleharvest-views-application-appstofile-grid',
					layout			: 'fit',
					columns			: [
					       			   { header : 'Name', 				dataIndex : 'Full Name', 		flex : 1 },
					       			   { header : 'Date Downloaded', 	dataIndex : 'Date Downloaded', 	flex : 1 },
					       			   { header : 'Date Profiled', 		dataIndex : 'Date Profiled', 	flex : 1 },
					       			   { header : 'Version', 			dataIndex : 'Version', 			flex : 1 }
					       			   ],
	       			store	: Ext.create('Ext.data.Store',
			    			{
				    			model			: 'AmpleHarvest.DATA.Model.gsSolr',
				    			data			: obj_data,
				    			proxy			: {
				    				type	: 'memory',
				    				reader	: {
				    					type : 'json',
				    					root : 'data'
				    				}
				    			}
			    			}),
	    			listeners		:
	    			{
	    				itemdblclick : function(model, record, index)
	    				{
	    					var obj_params = new Object();
	    					obj_params.record = record;
	    					obj_params.m_str_id = record.get('id');
	    					if(obj_params.m_str_id == undefined)
	    					{
	    						obj_params.m_str_id = record.get('Id');
	    					}
	    					
	    					m_obj_AmpleHarvest_ViewPort.fireEvent(AmpleHarvest.eventHandler.cWindowEvents.C_STR_EVENT_APPLICATION_OPEN, obj_params, this);
	    					this.ownerCt.close();
	    				}
	    			}
				})
		
		
		
		
		this.items = [ obj_applist ];

		this.callParent();
	}
}
);